class Item:
    def __init__(self, name, area):
        self.name = name
        self.area = area
        
    def __repr__(self):
        return f"name:{self.name}, area:{self.area}"
    
class House:
    def __init__(self, address, area):
        self.address = address
        self.area = area
        self.free_area = self.area
        self.items = []
    
    def __str__(self):
        return f"address:{self.address}, area:{self.area}, free_area:{self.free_area}"
    
    def add_item(self, item: Item):
        if self.free_area >= item.area:
            self.items.append(item)
            self.free_area -= item.area
            print("添加成功")
        else:
            print("面积不足，添加失败")
            

# 创建家具
item1 = Item('桌子', 40)
item2 = Item('椅子', 10)
item3 = Item('家庭影院', 80)
print(item1)
print(item2)
print(item3)

# 创建房子
house = House('深圳湾一号', 100)
# 打印家具
print(house)

print("---------------------------------------------")
# 添加家具
house.add_item(item1)
house.add_item(item2)
house.add_item(item3)
print(house)
print("所有家具:{}".format(house.items))